constraintlayout: Emit less change notification
authorMatthias Clasen <mclasen@redhat.com>
Fri, 30 Oct 2020 18:57:58 +0000 (14:57 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 30 Oct 2020 19:04:13 +0000 (15:04 -0400)
This isn't strictly required for correctness, but
it makes the GtkBuilder codepath do the same that
the vfl codepath does: call gtk_layout_manager_layout_changed
only once, after all the constraints have been added.

gtk/gtkconstraintlayout.c

index 20027b480ce0bd0e363158d51225876b215d9b1d..86ae56ce06797bc4e2cc1eb49cc10a820c39234d 100644 (file)
@@ -1696,9 +1696,14 @@ gtk_constraint_layout_custom_finished (GtkBuildable *buildable,
               continue;
             }
 
-          gtk_constraint_layout_add_constraint (data->layout, c);
+          layout_add_constraint (data->layout, c);
+          g_hash_table_add (data->layout->constraints, c);
+          if (data->layout->constraints_observer)
+            g_list_store_append (data->layout->constraints_observer, c);
         }
 
+      gtk_layout_manager_layout_changed (GTK_LAYOUT_MANAGER (data->layout));
+
       g_list_free_full (data->constraints, constraint_data_free);
       g_list_free_full (data->guides, guide_data_free);
       g_object_unref (data->layout);